package com.card.admin.pojo;

import java.util.ArrayList;
import java.util.List;

import com.card.user.StringParam;
import com.google.common.collect.Lists;
import com.google.gson.reflect.TypeToken;
import com.xiaoao.net.db.DBManager;
import com.xiaoao.net.db.Entity;
import com.xiaoao.net.utils.MathUtils;
import com.xiaoao.net.utils.PubFunc;
import com.xiaoao.net.utils.json.GSONUtils;

/**
 * 管理员
 * 
 * @author siyunlong
 * @version 1.0
 * @date 2013-6-27上午10:10:08
 *
 */
public class Julebu {
	private int id;
	private String name;
	private String guanliyuanid;
	private int state;
	private String mjroomsetting;
	private String ddzroomsetting;
	private String pdkroomsetting;
	private String zjhroomsetting;
	private String nnroomsetting;

	private transient Entity entity;

	public Julebu() {
	}

	public Julebu(Entity entity) {
		this.entity = entity;
		setId(MathUtils.parseInt(entity.getKey().getName()));
		setName((String) entity.getProperty(StringParam.JulebuName));
		setState(PubFunc.parseInt(entity.getProperty(StringParam.State)));
		setGuanliyuanid((String) entity.getProperty(StringParam.Guanliyuanid));
		setMjroomsetting((String) entity.getProperty(StringParam.Mjroomsetting));
		setDdzroomsetting((String) entity.getProperty(StringParam.Ddzroomsetting));
		setPdkroomsetting((String) entity.getProperty(StringParam.Pdkroomsetting));
		setZjhroomsetting((String) entity.getProperty(StringParam.Zjhroomsetting));
		setNnroomsetting((String) entity.getProperty(StringParam.Nnroomsetting));
	}



	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Entity getEntity() {
		return entity;
	}

	public String getGuanliyuanid() {
		return guanliyuanid;
	}

	public void setGuanliyuanid(String guanliyuanid) {
		this.guanliyuanid = guanliyuanid;
	}

	public String getMjroomsetting() {
		return mjroomsetting;
	}

	public void setMjroomsetting(String mjroomsetting) {
		this.mjroomsetting = mjroomsetting;
	}

	public String getDdzroomsetting() {
		return ddzroomsetting;
	}

	public void setDdzroomsetting(String ddzroomsetting) {
		this.ddzroomsetting = ddzroomsetting;
	}

	public String getPdkroomsetting() {
		return pdkroomsetting;
	}

	public void setPdkroomsetting(String pdkroomsetting) {
		this.pdkroomsetting = pdkroomsetting;
	}

	public String getZjhroomsetting() {
		return zjhroomsetting;
	}

	public void setZjhroomsetting(String zjhroomsetting) {
		this.zjhroomsetting = zjhroomsetting;
	}

	public String getNnroomsetting() {
		return nnroomsetting;
	}

	public void setNnroomsetting(String nnroomsetting) {
		this.nnroomsetting = nnroomsetting;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public boolean isFree() {
		return this.state == StringParam.State_Free;
	}

	public String getStateTtr() {
		return this.state == StringParam.State_Free ? "冻结" : "解冻";
	}

	public String getShowState() {
		return this.state == StringParam.State_Free ? "正常" : "已冻结";
	}

	public void saveDB() {
		DBManager.getInstance().saveOrUpdate(entity);
	}

	
}
